package annuaire.beans;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;

/**
 * Bean représentant un administrateur.
 * 
 * @author Yannick Lorenzati & Stephanie Malakian
 * 
 */
@Entity(name = "Admin")
public class Admin implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -4063921282444660310L;

	@Id()
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Basic(optional = false)
	@Column(name = "login", length = 200, nullable = false, unique = true)
	private String login;

	@Basic(optional = false)
	@Column(name = "pwd", length = 200, nullable = false, unique = false)
	private String pwd;

	@Version
	private long version = 0;

	public Admin() {
	}

	public Admin(String login, String pwd) {
		super();
		this.login = login;
		this.pwd = pwd;
	}

	@Override
	public String toString() {
		return "Administrateur : " + login;
	}

	/**
	 * @return the login
	 */
	public String getLogin() {
		return login;
	}

	/**
	 * @param login
	 *            the login to set
	 */
	public void setLogin(String login) {
		this.login = login;
	}

	/**
	 * @return the pwd
	 */
	public String getPwd() {
		return pwd;
	}

	/**
	 * @param pwd
	 *            the pwd to set
	 */
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setVersion(long version) {
		this.version = version;
	}

	public long getVersion() {
		return version;
	}

}
